package com.czy.springwebtest.controller;

import com.czy.springwebtest.utils.TestUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * restController 和 controller 的区别
 *
 * @author czy
 * @package com.czy.springwebtest.controller
 * @date 2020/10/20 9:44
 */
@Controller
public class Test2Controller {

    @Autowired
    TestUtil testUtil;

    @Autowired
    HttpServletRequest httpServletRequest;

    @GetMapping("/test2")
//    @ResponseBody
    public String test2() {
        System.out.println(httpServletRequest.getRequestURI()+"asd");
        testUtil.print();
        return "test2";
    }


    @GetMapping("/test4")
    //@ResponseBody
    public String test4() {
        System.out.println(httpServletRequest.getRequestURI()+"asd");
        return "forward:/www/1.jpg";
    }
}
